home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_01 / xmpl_03.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  816 b   |  36 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 1, example 3
  5.  
  6. -- create a module so that names used earlier in the chapter do not
  7. -- conflict with names used here
  8.  
  9. module Scratch1 uses ScriptX end
  10. in module Scratch1
  11.  
  12. class Dog ()
  13.     instance variables 
  14.         name, owner, breed, age, length, weight, sex, temperament
  15.     instance methods
  16.         method bark self -> print "makes a lot of noise" 
  17.         method fetch self -> print "fetches a stick" 
  18.         method sniff self -> print "sticks nose into things"
  19. end
  20.  
  21. class HuntingHound (Dog)
  22.     instance methods
  23.         method bark self -> print "wooof, wooof"
  24. end
  25.  
  26. class BassetHound (HuntingHound)
  27.     instance methods
  28.         method drool self -> print "slobbers all over everything"
  29. end
  30.  
  31. object vaps (BassetHound)
  32.     settings name:"Vaps", owner:"The Crosbys"
  33. end
  34.  
  35. drool vaps
  36. -->>>